package com.yaodian100.ec.shelf.service;

import java.io.IOException;
import java.text.ParseException;
import java.util.Date;
import java.util.List;
import java.util.Map;

import com.yaodian100.core.common.exception.CoreException;
import com.yaodian100.core.common.service.DomainService;
import com.yaodian100.ec.product.entity.Product;
import com.yaodian100.ec.product.entity.ProductTuangouOP;
import com.yaodian100.ec.shelf.entity.ShelfTuangou;

public interface ShelfTuangouService extends DomainService<ShelfTuangou> {
	public ShelfTuangou getShelfTuangouByProductId(String productId, Date startDate, Date endDate) throws CoreException;

	public ShelfTuangou getActiveShelfTuangouByProductId(String productId) throws CoreException;

	public List<Map<String, Object>> getShelfTuangouHistory(String productId) throws Exception;

	public boolean checkShelfTuangouDate(String productId, String sDate, String sTime, String eDate, String eTime)
			throws Exception;

	public ShelfTuangou saveOrUpdateShelfTuangou(ShelfTuangou shelfTuangou) throws CoreException;

	/**
	 * 儲存團購操作紀錄
	 * 
	 * @param op
	 * @return
	 * @throws CoreException
	 */
	public ProductTuangouOP saveTuangouOPLog(ProductTuangouOP op) throws CoreException;

	public Number getShelfTuangouApproveListSize(Map<String, Object> attrs);

	public List<ShelfTuangou> getShelfTuangouApproveList(Map<String, Object> attrs, String[] sortBy, int startNode,
			int pageSize);

	public ProductTuangouOP queryOrderOperator(String tuangouId);

	public ShelfTuangou getShelfTuangouByTuangouId(Long tuangouId, Date startDate, Date endDate);

	public ShelfTuangou getActiveShelfTuangouByTuangouId(Long tuangouId);

	public List<ShelfTuangou> getTodayTuangouList(Long nowTuangouId) throws ParseException;

	public Map<String, String> getTodayPrdNameMap(List<ShelfTuangou> todayTuangouList);

	public List<ShelfTuangou> getHistoryTuangouList(int startNode, int returnSize) throws ParseException;

	public Map<String, Product> getPrdMap(List<ShelfTuangou> tuangouList);

	public boolean generateActivityList() throws ParseException, CoreException, IOException;

	public Map<String, Integer> getInvetoryMap(Map<String, Product> prdMap);

}